class DateTimeUtils {
  ///日期转时间戳
  static int dateToTimestamp(DateTime date, {isMicroseconds = false}) {
    int timestamp = date.millisecondsSinceEpoch;
    if (isMicroseconds) {
      timestamp = date.microsecondsSinceEpoch;
    }
    return timestamp;
  }

  ///日期转时间戳
  static int dateStringToTimestamp(String date, {isMicroseconds = false}) {
    DateTime dateTime = DateTime.parse(date);
    int timestamp = dateToTimestamp(dateTime);
    return timestamp;
  }
}
